import React from 'react'
import { View, Text } from 'react-native'
// other
import { rxEcho } from '../../utils/api';

class Component extends React.Component {
  constructor (props) {
    super(props)
  }

  componentDidMount () {
    const { navigation } = this.props

    // 初始化校验
    rxEcho().then((response) => {
      if (response.errno == 0) {
        // 验证成功, 跳转到首页
        navigation.navigate('HomeNavigator')
      } else {
        // 验证失败, 需要重新登陆
        navigation.navigate('LoginScreen')
      }
    })
  }

  render() {
    return (
      <View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
        <Text>Page Init</Text>
      </View>
    );
  }
}

export default Component;
